package com.bi.onlineEducation.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * comment_info
 *
 * @author
 */
@Entity
@Table(name = "comment_info")
@ApiModel(value = "com.bi.onlineEducation.domain.CommentInfo跟课程表多对一的关系")
@Data
public class CommentInfoPo implements Serializable {
    /**
     * 评论主键ID
     */
    @Id
    @Column(name = "ci_id")
    @GeneratedValue(generator = "JDBC")
    @ApiModelProperty(value = "评论主键ID")
    private Integer ciId;

    /**
     * 评论内容
     */
    @Column(name = "ci_content")
    @ApiModelProperty(value = "评论内容")
    private String ciContent;

    /**
     * 所属课程
     */
    @Column(name = "c_id")
    @ApiModelProperty(value = "所属课程")
    private Integer cId;

    @OneToOne//sales_order是关系的维护端，当删除 sales_order，会级联删除 person
    @JoinColumn(name = "c_id", referencedColumnName = "c_id",insertable=false,updatable=false, nullable=true,foreignKey = @ForeignKey(name = "none",value = ConstraintMode.NO_CONSTRAINT))//sales_order中的bykh字段参考person表中的id字段
    private CoursePo course;    //PurchasePo中的c_id字段参考CoursePo表中的id字段

    /**
     * 评论人
     */
    @Column(name = "l_id")
    @ApiModelProperty(value = "评论人")
    private Integer lId;

    @OneToOne//sales_order是关系的维护端，当删除 sales_order，会级联删除 person
    @JoinColumn(name = "l_id", referencedColumnName = "l_id",insertable=false,updatable=false, nullable=true,foreignKey = @ForeignKey(name = "none",value = ConstraintMode.NO_CONSTRAINT))//sales_order中的bykh字段参考person表中的id字段
    private LoginPo login;    //PurchasePo中的c_id字段参考CoursePo表中的id字段

    /**
     * 评论时间
     */
    @Column(name = "ci_create_time")
    @ApiModelProperty(value = "评论时间")
    private LocalDateTime ciCreateTime;

    /**
     * 点赞数
     */
    @Column(name = "ci_like")
    @ApiModelProperty(value = "点赞数")
    private Integer ciLike;

    private static final long serialVersionUID = 1L;
}